package destiny;

import destiny.common.阴阳;
import destiny.五行.五行;

public class 术数 {
	private int value;

	private 五行 element;
	private 阴阳 yinYang;

	public 术数(int value, 五行 element, 阴阳 yinYang) {
		this.value = value;
		this.element = element;
		this.yinYang = yinYang;
	}

	public 术数(int value, 五行 element) {
		this.value = value;
		this.element = element;
		yinYang = (Math.abs(value % 2) == 1) ? 阴阳.阳 : 阴阳.阴;
	}

	public int getValue() {
		return value;
	}

	public 五行 五行() {
		return element;
	}

	public 阴阳 阴阳() {
		return yinYang;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof 术数))
			return false;
		术数 shu = (术数) obj;

		boolean ret = element.equals(shu.element)
				&& yinYang.equals(shu.yinYang);
		if (value >= 0 && shu.value >= 0)
			ret = ret && (value == shu.value);

		return ret;
	}
}
